package day15;

public class RunableDemo01 implements  Runnable {
    @Override
    public void run() {
        for (int i = 0; i < 10; i++) {
            System.out.println(Thread.currentThread().getName()+":"+i);
            try {
                Thread.sleep(1000);

            }
            catch (InterruptedException e){
                e.printStackTrace();
            }
        }
    }
}
class TestRunableDemo01{
    public static void main(String[] args) {
        Runnable r = new RunableDemo01();

        //创建线程对象
        Thread t1 = new Thread(r);
        Thread t2 = new Thread(r);

        t1.start();
        t2.start();
    }
}
